package com.lineage.server.serverpackets;

import com.lineage.server.model.Instance.L1ItemInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import java.util.Iterator;
import java.util.List;

public class S_WhoXljnet extends ServerBasePacket {
  private byte[] _byte;
  
  public S_WhoXljnet(L1PcInstance pc, int objid, List<L1ItemInstance> items) {
    this._byte = null;
    writeC(176);
    writeD(objid);
    writeH(items.size());
    writeC(12);
    Iterator<L1ItemInstance> iterator = items.iterator();
    while (iterator.hasNext()) {
      L1ItemInstance item = iterator.next();
      int itemobjid = item.getId();
      writeD(itemobjid);
      writeC(0);
      writeH(item.get_gfxid());
      writeC(item.getBless());
      writeD(1);
      writeC(1);
      writeS(item.getViewName());
    } 
    items.clear();
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
